#!/usr/bin/perl
#
# This code is distributed under the terms of the GPL
#
# (c) Scott Knight 2004
# (c) Tiago Freitas Leal

require '/var/smoothwall/mods/display_dns/modlib.pl';

# # # # # # # # # # # # # # # # # # #
# check for existing installations  #
# # # # # # # # # # # # # # # # # # #

#if (-e "/var/smoothwall/mods/display_dns/installed") {
#	if (&installed ("/var/smoothwall/mods/display_dns/installed", "# Display DNS v1.0")) {
#		print "\nPlease remove Display DNS v1.0\n";
#		print "Note - Run uninstall.pl script.\n \n";
#		exit;
#	}
#}

# # # # # # # # # # # #
# handle file copying #
# # # # # # # # # # # #

#	$storebkp =	where to store backup of the files that are changed by your mod
#	$moddir =	where your mod files are
#	$wkdir =	where you are changing files (backup from and copy to)
#
#	backupinstall ($file, $wkdir, $storebkp, $moddir);
#	backup ($file, $wkdir, $storebkp);
#	install ($file, $wkdir, $moddir);
#	uninstallrestore ($file, $wkdir, $storebkp);
#	uninstall ($file , $wkdir);
#
#	installed ($file, $string);
#
#	search for $string into $file => 1 found / 0 not found
#      &easymod ($targetfile, $searchfile, $linestodelete, $insertfile [,$times])


$dir = '/httpd/cgi-bin';
my $bkp = '/var/smoothwall/mods/display_dns/backup';

print "Backuping up files ...\n";
&backup ('advstatus.cgi', $dir, $bkp);


# # # # # # # # # # # #
# handle file editing #
# # # # # # # # # # # #

my $param = '/var/smoothwall/mods/display_dns/params';

&easymod ("/httpd/cgi-bin/advstatus.cgi","$param/advstatus.cgi.2.s","1","$param/advstatus.cgi.2.r");
&easymod ("/httpd/cgi-bin/advstatus.cgi","$param/advstatus.cgi.0.s","1","$param/advstatus.cgi.0.r");
&easymod ("/httpd/cgi-bin/advstatus.cgi","$param/advstatus.cgi.1.s","0","$param/advstatus.cgi.1.r");


# # # # # # # # # # # #
# handle file linking #
# # # # # # # # # # # #

print "Done\n\n";

# # # #
# end #
# # # #
